package a.f.l.a;

import a.c.d;
import a.c.n;
import a.c.q;
import a.c.v;
import a.c.y;
import a.c.z;
import a.d.t;

import java.util.HashMap;
import java.util.Iterator;
import java.util.List;

class fb
{
  private final mb a;
  private final cb b;
  private final z c;
  private final z d;
  private final z e;
  private final HashMap f;
  private double g;
  private z h;
  private z i;
  private static final int j = 0;
  private static final int k = 1;
  private static final int l = 2;
  private static final int m = 3;
  private double[] n;
  private double[] o;
  private boolean[] p;
  private List[] r;
  
  fb(mb parammb, double paramDouble, cb paramcb)
  {
    this.a = parammb;
    this.b = paramcb;
    this.g = ((sb.e) || (paramcb != null) ? paramcb.c() * Math.ceil(paramDouble / paramcb.c()) : paramDouble);
    this.c = new z();
    this.d = new z();
    this.e = new z();
    this.f = new HashMap();
    this.n = new double[] { -1.797693134862316E+308D, -1.797693134862316E+308D, 1.7976931348623157E+308D, 1.7976931348623157E+308D };
    this.o = new double[] { parammb.i(), parammb.j(), parammb.k(), parammb.l() };
    this.p = new boolean[4];
  }
  
  private int a(int paramInt)
  {
    return (paramInt + 2) % 4;
  }
  
  private boolean c(int paramInt)
  {
    if (!sb.e) {}
    return paramInt <= 1;
  }
  
  private boolean d(int paramInt)
  {
    boolean bool = sb.e;
    if (!bool) {
      if (paramInt != 0) {
        if (bool) {
          break label22;
        }
      }
    }
    label22:
    return paramInt == 2;
  }
  
  private List[] a()
  {
    boolean bool = sb.e;
    int i1 = sb.d;
    if ((bool) || (this.r == null))
    {
      this.r = new List[4];
      t localt = new t(this.a.i() - this.g, this.a.j() - this.g, this.a.m() + 2.0D * this.g, this.a.n() + 2.0D * this.g);
      Iterator localIterator = this.a.e().a(localt).iterator();
      do
      {
        do
        {
          mb localmb;
          do
          {
            do
            {
              if (!localIterator.hasNext()) {
                break;
              }
              localmb = (mb)localIterator.next();
            } while (this.a == localmb);
            if ((bool) || (i1 != 0)) {
              break label265;
            }
            if (!bool) {
              if (this.a.i() >= localmb.k()) {
                a(localmb, 0);
              }
            }
            if (!bool) {
              if (this.a.k() <= localmb.i()) {
                a(localmb, 2);
              }
            }
            if (!bool) {
              if (this.a.j() >= localmb.l()) {
                a(localmb, 1);
              }
            }
            if (bool) {
              break;
            }
          } while (this.a.l() > localmb.j());
          a(localmb, 3);
        } while (bool);
      } while (i1 == 0);
    }
    label265:
    return this.r;
  }
  
  private void a(mb parammb, int paramInt)
  {
    Object localObject = this.r[paramInt];
    if (!sb.e) {
      if (localObject == null)
      {
        void tmp29_26 = new z();
        localObject = tmp29_26;
        this.r[paramInt] = tmp29_26;
      }
    }
    ((List)localObject).add(parammb);
  }
  
  private double c(mb parammb, int paramInt)
  {
    switch (paramInt)
    {
    case 0: 
      return parammb.i();
    case 1: 
      return parammb.j();
    case 2: 
      return parammb.k();
    }
    return parammb.l();
  }
  
  public z c()
  {
    return this.c;
  }
  
  public boolean[] a(jb[] paramArrayOfjb, boolean[] paramArrayOfBoolean)
  {
    boolean bool2 = sb.e;
    int i2 = sb.d;
    boolean[] arrayOfBoolean = new boolean[paramArrayOfjb.length];
    int i1 = 0;
    do
    {
      if (i1 >= paramArrayOfjb.length) {
        break;
      }
      jb localjb = paramArrayOfjb[i1];
      if (!bool2) {}
      boolean bool1 = !localjb.a();
      a(bool1);
      if (!bool2) {
        if ((bool1) && ((bool2) || (this.h == null))) {
          a(new eb(this.o[0], this.o[2]), true);
        }
      }
      if ((bool2) || ((i2 != 0) && (!bool1))) {
        if ((bool2) || (this.i == null)) {
          a(new eb(this.o[1], this.o[3]), false);
        }
      }
      arrayOfBoolean[i1] = a(localjb, bool1 ? this.h : this.i, paramArrayOfBoolean[i1]);
      i1++;
    } while (i2 == 0);
    return arrayOfBoolean;
  }
  
  public boolean[] a(jb[] paramArrayOfjb, List paramList)
  {
    boolean bool = sb.e;
    int i2 = sb.d;
    z localz1 = new z(this.d);
    z localz2 = new z(this.e);
    Object localObject1 = paramList.iterator();
    if (((Iterator)localObject1).hasNext()) {}
    while (bool)
    {
      localObject2 = (jb)((Iterator)localObject1).next();
      if (i2 != 0) {
        break label115;
      }
      a(new a_((jb)localObject2), ((jb)localObject2).a() ? localz1 : localz2);
      if (i2 == 0) {
        break;
      }
    }
    a(true);
    label115:
    localObject1 = a(new eb(this.o[0], this.o[2]), localz2, true);
    a(false);
    Object localObject2 = a(new eb(this.o[1], this.o[3]), localz1, false);
    boolean[] arrayOfBoolean = new boolean[paramArrayOfjb.length];
    int i1 = 0;
    do
    {
      if (i1 >= paramArrayOfjb.length) {
        break;
      }
      jb localjb = paramArrayOfjb[i1];
      if ((!bool) && (i2 != 0)) {
        break label243;
      }
      arrayOfBoolean[i1] = a(localjb, localjb.a() ? localObject2 : (z)localObject1, false);
      i1++;
    } while (i2 == 0);
    label243:
    return arrayOfBoolean;
  }
  
  private boolean a(jb paramjb, z paramz, boolean paramBoolean)
  {
    boolean bool2 = sb.e;
    int i2 = sb.d;
    if (!bool2) {}
    boolean bool1 = !paramjb.a();
    eb localeb1 = (this.b != null) && (!paramBoolean) ? this.b.b(paramjb.e(), bool1) : paramjb.e();
    if (!bool2) {
      if (localeb1 == null) {
        return false;
      }
    }
    double d1 = Math.max(localeb1.a(), bool1 ? this.o[0] : this.o[1]);
    double d2 = Math.min(localeb1.b(), bool1 ? this.o[2] : this.o[3]);
    if ((bool2) || (d1 > d2)) {
      return false;
    }
    Iterator localIterator = paramz.iterator();
    while (localIterator.hasNext())
    {
      eb localeb2 = (eb)localIterator.next();
      if (localeb2.b() > d1)
      {
        if ((bool2) || (i2 != 0)) {
          break label249;
        }
        if (localeb2.a() < d1) {
          if (bool2) {}
        }
        int i1 = localeb2.b() > d2 ? 1 : 0;
        if (!bool2) {}
        return i1 == 0;
      }
    }
    label249:
    return true;
  }
  
  private void a(boolean paramBoolean)
  {
    boolean bool = sb.e;
    if (!bool) {
      if (paramBoolean)
      {
        if (!bool) {
          if (!e(0))
          {
            if (!bool) {
              if (!e(2)) {
                return;
              }
            }
          }
          else {
            this.h = null;
          }
        }
        if (!bool) {
          if (sb.d == 0) {
            return;
          }
        }
      }
      else
      {
        if (bool) {
          break label76;
        }
      }
    }
    if (!e(1))
    {
      if ((!bool) && (!e(3))) {}
    }
    else {
      label76:
      this.i = null;
    }
  }
  
  private boolean e(int paramInt)
  {
    boolean bool = sb.e;
    int i1 = sb.d;
    if (!bool) {
      if (this.p[paramInt] != 0)
      {
        double d1 = c(this.a, paramInt);
        List localList = a()[paramInt];
        if ((bool) || (localList != null))
        {
          Iterator localIterator = localList.iterator();
          label134:
          do
          {
            double d2;
            do
            {
              if (!localIterator.hasNext()) {
                break label137;
              }
              fb localfb = ((mb)localIterator.next()).b();
              d2 = localfb.n[paramInt];
              if (i1 != 0) {
                break label150;
              }
              if (!c(paramInt)) {
                break;
              }
              d1 = Math.max(d1, d2);
              if (bool) {
                break label134;
              }
            } while (i1 == 0);
            d1 = Math.min(d1, d2);
          } while (i1 == 0);
        }
        label137:
        if ((bool) || (this.o[paramInt] != d1))
        {
          label150:
          this.o[paramInt] = d1;
          this.p[paramInt] = false;
          return true;
        }
      }
    }
    return false;
  }
  
  public void a(m paramm)
  {
    b_ localb_ = new b_(paramm);
    localb_.a();
    a(localb_, paramm.k());
  }
  
  private static void a(b_ paramb_, d paramd)
  {
    q localq = paramd.c();
    n localn = (n)localq.c(a.n);
    z localz = (z)localn.get(paramd);
    if (!sb.e) {
      if (localz == null)
      {
        localz = new z();
        localn.a(paramd, localz);
      }
    }
    localz.add(paramb_);
  }
  
  private v a(a_ parama_, z paramz)
  {
    boolean bool = sb.e;
    int i1 = sb.d;
    eb localeb = parama_.b;
    double d1 = localeb.a();
    double d2 = localeb.b();
    v localv1 = paramz.f();
    Object localObject = (bool) || (localv1 != null) ? ((a_)localv1.c()).b : null;
    if ((localObject != null) && (((!bool) && (localObject.b() < d2)) || ((bool) || ((localObject.b() == d2) && (localObject.a() <= d1))))) {
      localv1 = localv1.a();
    }
    while (bool)
    {
      localObject = (bool) || (localv1 != null) ? ((a_)localv1.c()).b : null;
      if (i1 == 0) {
        break;
      }
    }
    if (!bool) {
      if (localv1 != null)
      {
        if (bool) {
          break label186;
        }
        localv2 = paramz.a(parama_, localv1);
        if (i1 == 0) {
          break label188;
        }
      }
    }
    label186:
    v localv2 = paramz.b(parama_);
    label188:
    return localv2;
  }
  
  private double f(int paramInt)
  {
    boolean bool3 = sb.e;
    int i1 = sb.d;
    boolean bool1 = d(paramInt);
    boolean bool2 = c(paramInt);
    double d1 = bool2 ? 1.7976931348623157E+308D : -1.797693134862316E+308D;
    z localz = bool1 ? this.d : this.e;
    Iterator localIterator = localz.iterator();
    label134:
    do
    {
      a_ locala_;
      do
      {
        if (!localIterator.hasNext()) {
          break label137;
        }
        locala_ = (a_)localIterator.next();
        if (bool3) {
          break label134;
        }
        if (!bool2) {
          break;
        }
        d1 = Math.min(d1, locala_.b.a());
        if (bool3) {
          break label134;
        }
      } while (i1 == 0);
      d1 = Math.max(d1, locala_.b.b());
    } while (i1 == 0);
    label137:
    return d1;
  }
  
  private void a(int paramInt, double paramDouble, boolean paramBoolean)
  {
    boolean bool = sb.e;
    double d1 = this.n[paramInt];
    if (!bool) {
      if (paramBoolean)
      {
        if (bool) {
          break label81;
        }
        if (paramDouble != d1) {
          break label80;
        }
      }
    }
    if ((bool) || (!paramBoolean))
    {
      if (!bool) {
        if (c(paramInt))
        {
          if (paramDouble <= d1) {
            break label84;
          }
          break label80;
        }
      }
      if (bool) {}
    }
    label80:
    label81:
    label84:
    int i1 = paramDouble < d1 ? 1 : 0;
    if (!bool)
    {
      if (i1 != 0) {
        this.n[paramInt] = paramDouble;
      }
    }
    else
    {
      double d2 = c(this.a, a(paramInt));
      if (!bool) {}
      int i2 = c(paramInt) ? 1 : -1;
      if ((bool) || ((i2 * d2 < i2 * d1) || (i2 * d2 < i2 * paramDouble))) {
        g(paramInt);
      }
    }
  }
  
  private void g(int paramInt)
  {
    boolean bool = sb.e;
    int i1 = sb.d;
    List localList = a()[a(paramInt)];
    if ((bool) || (localList != null))
    {
      Iterator localIterator = localList.iterator();
      do
      {
        if (!localIterator.hasNext()) {
          break;
        }
        mb localmb = (mb)localIterator.next();
        fb localfb = localmb.b();
        localfb.p[paramInt] = true;
      } while (i1 == 0);
    }
  }
  
  private void a(eb parameb, boolean paramBoolean)
  {
    boolean bool = sb.e;
    z localz1 = paramBoolean ? this.e : this.d;
    z localz2 = a(parameb, localz1, paramBoolean);
    if (!bool)
    {
      if (paramBoolean)
      {
        if (bool) {
          break label59;
        }
        this.h = localz2;
      }
    }
    else if (sb.d == 0) {
      return;
    }
    label59:
    this.i = localz2;
  }
  
  private z a(eb parameb, z paramz, boolean paramBoolean)
  {
    boolean bool = sb.e;
    int i1 = sb.d;
    z localz = new z();
    if (!bool) {
      if (paramz.size() == 0) {
        return localz;
      }
    }
    if ((bool) || (!a(paramz, parameb, paramBoolean)))
    {
      localz.add(new eb(parameb.a() - this.g, parameb.b() + this.g));
      return localz;
    }
    Iterator localIterator = paramz.iterator();
    label300:
    label350:
    label353:
    do
    {
      Object localObject2;
      do
      {
        a_ locala_;
        do
        {
          if (!localIterator.hasNext()) {
            break;
          }
          locala_ = (a_)localIterator.next();
        } while (locala_.d - locala_.c >= 2.0D * this.g);
        double d1 = locala_.d - this.g;
        double d2 = locala_.c + this.g;
        Object localObject1 = null;
        if ((bool) || (i1 != 0)) {
          break label358;
        }
        localObject2 = localz.f();
        for (;;)
        {
          if (localObject2 == null) {
            break label300;
          }
          eb localeb = (eb)((v)localObject2).c();
          if ((bool) || (i1 != 0)) {
            break;
          }
          if (localeb.a() >= d2)
          {
            localObject1 = localObject2;
            break label300;
          }
          if (!bool)
          {
            if (localeb.b() <= d1)
            {
              localObject2 = ((v)localObject2).a();
              if (!bool) {
                if (i1 == 0) {
                  continue;
                }
              }
            }
            else
            {
              d1 = Math.min(d1, localeb.a());
            }
          }
          else {
            d2 = Math.max(d2, localeb.b());
          }
          Object localObject3 = localObject2;
          localObject2 = ((v)localObject2).a();
          localz.h(localObject3);
        }
        localObject2 = new eb(d1, d2);
        if (bool) {
          break label350;
        }
        if (localObject1 == null) {
          break;
        }
        localz.a(localObject2, localObject1);
        if (bool) {
          break label353;
        }
      } while (i1 == 0);
      localz.b(localObject2);
    } while (i1 == 0);
    label358:
    return localz;
  }
  
  private boolean a(z paramz, eb parameb, boolean paramBoolean)
  {
    boolean bool = sb.e;
    int i1 = sb.d;
    eb localeb = (bool) || (this.b != null) ? this.b.b(parameb, paramBoolean) : parameb;
    if (localeb == null) {
      return false;
    }
    z localz = new z(paramz);
    double d1 = localeb.a();
    a_ locala_;
    double d2;
    do
    {
      do
      {
        if (localz.size() <= 0) {
          break;
        }
        locala_ = a(localz, d1);
        d2 = Math.max(d1, locala_.b.a());
        locala_.c = d2;
        if (bool) {
          break label150;
        }
        d1 = a(d2 + this.g, paramBoolean);
        if (i1 != 0) {
          break label145;
        }
      } while (i1 == 0);
    } while (bool);
    localz = new z(paramz);
    label145:
    label150:
    d1 = localeb.b();
    do
    {
      do
      {
        if (localz.size() <= 0) {
          break;
        }
        locala_ = b(localz, d1);
        d2 = Math.min(d1, locala_.b.b());
        locala_.d = d2;
        d1 = c(d2 - this.g, paramBoolean);
      } while (i1 == 0);
    } while (bool);
    return true;
  }
  
  private a_ a(z paramz, double paramDouble)
  {
    boolean bool = sb.e;
    int i1 = sb.d;
    double d1 = 1.7976931348623157E+308D;
    Object localObject = null;
    v localv = paramz.f();
    if (localv != null) {}
    while (bool)
    {
      a_ locala_ = (a_)localv.c();
      if (bool) {
        break label123;
      }
      if (i1 != 0) {
        break label120;
      }
      if (!bool) {
        if (locala_.b.a() < d1)
        {
          localObject = localv;
          d1 = locala_.b.a();
        }
      }
      if (!bool)
      {
        if (d1 > paramDouble) {
          localv = localv.a();
        }
      }
      else {
        if (i1 == 0) {
          break;
        }
      }
    }
    label120:
    label123:
    return (a_)paramz.h(localObject);
  }
  
  private a_ b(z paramz, double paramDouble)
  {
    boolean bool = sb.e;
    int i1 = sb.d;
    double d1 = -1.797693134862316E+308D;
    Object localObject = null;
    v localv = paramz.g();
    if (localv != null) {}
    while (bool)
    {
      a_ locala_ = (a_)localv.c();
      if (bool) {
        break label123;
      }
      if (i1 != 0) {
        break label120;
      }
      if (!bool) {
        if (locala_.b.b() > d1)
        {
          localObject = localv;
          d1 = locala_.b.b();
        }
      }
      if (!bool)
      {
        if (d1 < paramDouble) {
          localv = localv.b();
        }
      }
      else {
        if (i1 == 0) {
          break;
        }
      }
    }
    label120:
    label123:
    return (a_)paramz.h(localObject);
  }
  
  private double a(double paramDouble, boolean paramBoolean)
  {
    if (this.b != null)
    {
      double d1 = paramBoolean ? this.b.a() : this.b.b();
      return Math.ceil((paramDouble - d1) / this.b.c() * this.b.c()) + d1;
    }
    return paramDouble;
  }
  
  private double c(double paramDouble, boolean paramBoolean)
  {
    if (this.b != null)
    {
      double d1 = paramBoolean ? this.b.a() : this.b.b();
      return Math.floor((paramDouble - d1) / this.b.c() * this.b.c()) + d1;
    }
    return paramDouble;
  }
  
  class a_
  {
    z a;
    eb b;
    double c;
    double d;
    
    a_(e parame)
    {
      this.b = (((bool) || (fb.this.b != null)) && ((bool) || (fb.this.b.a(parame.c(), parame.g()))) ? fb.this.b.b(parame.c(), parame.g()) : parame.c());
      this.a = new z();
      this.a.add(parame);
    }
    
    a_(jb paramjb)
    {
      eb localeb = paramjb.e();
      if ((bool) || (fb.this.b != null))
      {
        if (!bool) {}
        if (bool) {}
      }
      this.b = (fb.this.b.a(localeb, !paramjb.a()) ? fb.this.b.b(localeb, !paramjb.a()) : localeb);
    }
  }
  
  class b_
  {
    private final m a;
    private final z c;
    private v d;
    
    b_(m paramm)
    {
      this.a = paramm;
      this.c = new z(paramm.q());
    }
    
    void a()
    {
      boolean bool = sb.e;
      int i = sb.d;
      if (!bool)
      {
        if (this.d != null) {
          e();
        }
        this.d = fb.this.c.b(this.a);
      }
      Iterator localIterator = this.c.iterator();
      label215:
      label253:
      do
      {
        do
        {
          if (!localIterator.hasNext()) {
            return;
          }
          e locale = (e)localIterator.next();
          a(locale, locale.g() ? fb.this.e : fb.this.d);
          eb localeb = locale.c();
          if (!bool)
          {
            if (locale.g())
            {
              fb.this.a(0, localeb.b() + fb.this.g, false);
              fb.this.a(2, localeb.a() - fb.this.g, false);
              if (bool) {
                break label215;
              }
              if (i == 0) {}
            }
            else
            {
              fb.this.a(1, localeb.b() + fb.this.g, false);
            }
          }
          else {
            fb.this.a(3, localeb.a() - fb.this.g, false);
          }
          if (bool) {
            break label253;
          }
          if (!locale.g()) {
            break;
          }
          fb.this.h = null;
          if (bool) {
            break label253;
          }
        } while (i == 0);
        fb.this.i = null;
      } while (i == 0);
    }
    
    private void a(e parame, z paramz)
    {
      boolean bool = sb.e;
      pc localpc = parame.l();
      if (localpc != null)
      {
        if (bool) {
          break label70;
        }
        if (fb.this.f.containsKey(localpc))
        {
          localObject = (fb.a_)((v)fb.this.f.get(localpc)).c();
          ((fb.a_)localObject).a.add(parame);
          return;
        }
      }
      label70:
      Object localObject = fb.this.a(new fb.a_(fb.this, parame), paramz);
      if (!bool) {}
      fb.this.f.put(localpc != null ? localpc : parame, localObject);
    }
    
    public d c()
    {
      return this.a.k();
    }
    
    public m d()
    {
      return this.a;
    }
    
    void e()
    {
      boolean bool = sb.e;
      int i = sb.d;
      if ((bool) || (this.d != null))
      {
        fb.this.c.h(this.d);
        this.d = null;
        y localy = this.c.h();
        label346:
        do
        {
          if (!localy.e()) {
            break;
          }
          e locale = (e)localy.j();
          pc localpc = locale.l();
          if (!bool) {}
          v localv = (v)fb.this.f.get(localpc != null ? localpc : locale);
          fb.a_ locala_ = (fb.a_)localv.c();
          locala_.a.remove(locale);
          if (!bool)
          {
            if (locala_.a.size() == 0)
            {
              if (!bool) {}
              fb.this.f.remove(localpc != null ? localpc : locale);
              if (!bool) {
                if (locale.g())
                {
                  fb.this.e.h(localv);
                  fb.this.h = null;
                  d1 = fb.this.f(0) - fb.this.g;
                  fb.this.a(2, d1, true);
                  d2 = fb.this.f(2) + fb.this.g;
                  fb.this.a(0, d2, true);
                  if (bool) {
                    continue;
                  }
                  if (i == 0) {
                    break label346;
                  }
                }
              }
              fb.this.d.h(localv);
              fb.this.i = null;
              double d1 = fb.this.f(1) - fb.this.g;
              fb.this.a(3, d1, true);
              double d2 = fb.this.f(3) + fb.this.g;
              fb.this.a(1, d2, true);
            }
            localy.f();
          }
        } while (i == 0);
      }
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.l.a.fb

 * JD-Core Version:    0.7.0.1

 */